package com.qyhl.webtv.module_live.teletext.program;


import com.qyhl.webtv.commonlib.entity.live.ProgramDetailBean;

/**
 * Created by qyhl on 2018/1/4.
 */

public class LiveNormalPresenter implements LiveNormalContract.LiveNormalPresenter {
    private LiveNormalContract.LiveNormalView mView;

    private LiveNormalModel mModel;

    public LiveNormalPresenter(LiveNormalContract.LiveNormalView mView) {
        this.mView = mView;
        this.mModel = new LiveNormalModel(this);
    }

    @Override
    public void getList(String proId) {
        mModel.getList(proId);
    }

    @Override
    public void getDetail(String proId) {
        mModel.getDetail(proId);
    }

    @Override
    public void getPlayPath(String name, String startTime, String endTime) {
        mModel.getPlayPath(name, startTime, endTime);
    }

    @Override
    public void setDetail(ProgramDetailBean bean) {
        mView.setDetail(bean);
    }

    @Override
    public void setDetailError(int code, String msg) {
        switch (code) {
            case 0:
                mView.setNetError(msg);
                break;
            case 1:
                mView.setEmpty(msg);
                break;
            case 2:
                mView.setError(msg);
                break;
            default:
                break;
        }
    }

    @Override
    public void getPathError(String msg) {
        mView.getPathError(msg);
    }

    @Override
    public void getPathSuccess(String url) {
        mView.getPathSuccess(url);
    }

    @Override
    public void cancel() {
        mView.cancel();
    }

    @Override
    public void click(String proId) {
        mModel.click(proId);
    }
}
